﻿//Write a program that enters file name along with its full file path (e.g. C:\WINDOWS\win.ini),
//reads its contents and prints it on the console. Find in MSDN how to use System.IO.File.ReadAllText(…).
//Be sure to catch all possible exceptions and print user-friendly error messages.


using System;
using System.IO;

public class ReadFileContent
{
    public static void Main(string[] args)
    {
        string filePath = @"C:\WINDOWS\win.ini";
        string filecontent = ReadFile(filePath);
        Console.WriteLine(filecontent);
    }

    private static string ReadFile(string filePath)
    {
        try
        {
            string fileContent = File.ReadAllText(filePath);
            return fileContent;
        }
        catch (ArgumentException)
        {
            return "Empty file path";
        }
        catch (FileNotFoundException)
        {
            return "File not found.";
        }
        catch (DirectoryNotFoundException)
        {
            return "Directory not found";
        }
        catch (UnauthorizedAccessException)
        {
            return "You have not access rights";
        }
        catch (IOException)
        {
            return "Can not open the file";
        }
    }
}